home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Supervisor's Toolkit
/
Network Supervisor's Toolkit.iso
/
tools
/
lu62
/
comm
/
curhscb.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-10
|
4KB
|
100 lines
#include "include.h"
#include <string.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdio.h>
extern void *hscb_lst_ptr;
extern void *nau_lst_ptr;
unsigned long findnau (void *np, void **naupp);
/*********************CRHSCB********************************************/
struct hscb *crhscb( mylu, partlu )
char *mylu,*partlu;
{
unsigned long rc;
struct hscb *whscb,*whscbq;
struct nau *wnau;
whscb = calloc (1,sizeof(struct hscb));
if (whscb == NULL )
return (NULL);
rc = findnau ( mylu ,&wnau);
if (rc != 0)
return (NULL);
whscb->naup = wnau;
memcpy (whscb->hslunam, partlu, 8);
wnau -> link = whscb;
if (hscb_lst_ptr == NULL )
hscb_lst_ptr = whscb;
else
{
whscbq = hscb_lst_ptr;
while (whscbq -> next != NULL )
whscbq = whscbq -> next;
whscbq -> next = whscb;
}
return (whscb);
}
/*************************FINDHSCB********************************/
struct hscb *findhscb( ccor )
char *ccor;
{
struct hscb *whscb;
whscb = hscb_lst_ptr;
if (whscb -> cor == ccor)
return(whscb);
whscb = whscb -> next;
do {
if (whscb ->cor == ccor)
return (whscb);
whscb = whscb -> next;
} while (whscb != NULL );
return (NULL);
}
/**************************DELHSCB************************************/
int delhscb (whscb)
struct hscb *whscb;
{
struct hscb *whscbq;
whscbq = hscb_lst_ptr;
if (whscbq == whscb)
hscb_lst_ptr = NULL;
do {
if ( whscbq -> next == whscb)
{
whscbq -> next == whscb -> next;
return;
}
whscbq = whscbq -> next;
} while ( whscbq != NULL );
return;
}
/****************************FINDNAU***********************************/
unsigned long findnau (np,naupp)
char *np;
struct nau **naupp;
{
struct nau *naup;
int i;
naup = nau_lst_ptr;
i = 0;
do {
if (memcmp( np, naup -> name,8) == 0)
{
*naupp = naup;
return ( NULL );
}
naup ++;
i++;
} while ( i < 10 );
return (i);
}
/******************************THE END *******************************/